package com.lagou;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.redis.core.RedisTemplate;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@SpringBootApplication
public class Application {
    @Resource
    private RedisTemplate<String,Integer> redisTemplate;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    //初始化redis库存数据
    @PostConstruct
    public void initGoodCounts() {
        redisTemplate.opsForValue().set("goods_count",100);
    }
}
